package com.mouse.damo.lw;

import com.jacob.com.Variant;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum VariantConvert {
    a1("String", Variant::getString),
    a2("Integer", Variant::getInt),
    a22("int", Variant::getInt),
    a3("Boolean", Variant::getBoolean),
    a4("Byte", Variant::getByte),
    a5("Double", Variant::getDouble),
    a6("Float", Variant::getFloat),
    a7("Long", Variant::getLong),
    a8("Short", Variant::getShort),;
    private String clazzName;
    private VariantTurn turn;

    public static Object getValueByName(Variant variant, String name) {
        VariantConvert[] values = values();
        for (VariantConvert convert : values) {
            if (convert.getClazzName().equalsIgnoreCase(name)) {
                return convert.getTurn().get(variant);
            }
        }
        return null;
    }
}
